/**
 * 时间处理工具
 */

import Browser = Laya.Browser;

export default class BrowserUtil {

    
    public static stageWidth = 750;
    public static stageHeight = 1334;
    private static _phyWidth: number;
    private static _phyHeight: number;
    private static _pixelRatio: number = -1;
    private static _holeTop: number = -1;

    constructor() {
    }

    public static init() {
        this._phyWidth = Browser.clientWidth * Browser.pixelRatio;
        this._phyHeight = Browser.clientHeight * Browser.pixelRatio;
        this._holeTop = 44;
    }

    public static get phyHeight(): number {
        return this._phyHeight;
    }

    public static get phyWidth(): number {
        return this._phyWidth;
    }
    //是否刘海屏
    public static get isHoleScreen(): Boolean {
        return this.phyHeight / this.phyWidth > 2
    }


    public static get isIPhoneX(): Boolean {
        if (innerWidth == 375 && innerHeight == 812 && Browser.pixelRatio == 3) {
            return true;
        }
        return false;
    }

    public static get isIPhoneXR(): Boolean {
        if (innerWidth == 414 && innerHeight == 896 && Browser.pixelRatio == 2) {
            return true;
        }
        return false;
    }

    public static get isIPhoneXSMAX(): Boolean {
        if (innerWidth == 414 && innerHeight == 896 && Browser.pixelRatio == 3) {
            return true;
        }
        return false;
    }

    public static get holeTop(): number {
        return this._holeTop;
    }

    public static get holeBottom(): number {
        if (this.isIPhoneX || this.isIPhoneXR || this.isIPhoneXSMAX) {
            return 34;
        }
        return 0;
    }
}
